package tools

import (
	"fmt"
	"gitee.com/mcp-office/agent/llm"
)

var DistanceTool = llm.Tools{
	Type: "function",
	Function: llm.Function{
		Name:        "get_distance",
		Description: "计算两地之间的直线距离(公里)",
		Parameters: &llm.Parameters{
			Type: "object",
			Properties: map[string]interface{}{
				"origin": map[string]string{
					"type":        "string",
					"description": "出发地城市名称",
				},
				"destination": map[string]string{
					"type":        "string",
					"description": "目的地城市名称",
				},
			},
			Required: []string{"origin", "destination"},
		},
	},
}

func GetDistance(origin, destination string) string {
	distance := 666.0
	return fmt.Sprintf(`{"origin":"%s","destination":"%s","distance_km":%.2f}`,
		origin, destination, distance)
}
